import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';

// 定义回调函数类型
typedef CallbackType = void Function();

/// 组件 - 设置页面
class SettingItemWidget extends StatelessWidget {
  final String title;

  final String iconPath;

  final CallbackType? onTap;

  const SettingItemWidget({super.key, required this.title, required this.iconPath, this.onTap});

  @override
  Widget build(BuildContext context) {
    return InkWell(
        onTap: onTap,
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            SvgPicture.asset(iconPath, width: 20, height: 17),
            const SizedBox(width: 10),
            Text(
              title,
              style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
            ),
            Expanded(flex: 1, child: Container()),
            const Icon(Icons.arrow_forward_ios, size: 18)
          ],
        ));
  }
}
